package com.hitemole.game;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Screen;
import com.hitemole.levelObject.Scores;
import com.hitemole.manager.ResourceManager;
import com.hitemole.screen.GameClientScreen;
import com.hitemole.screen.GameScreen;
import com.hitemole.screen.GameServerScreen;
import com.hitemole.screen.MenuScreen;
import com.hitemole.screen.ResourceScreen;
import com.hitemole.screen.ScoreScreen;


public class GameCore extends Game{

	private ResourceManager assetManager;
	private ResourceScreen resourceScreen;
	private GameScreen gameScreen;
	private ScoreScreen scoreScreen;
	private MenuScreen menuScreen;
	private GameServerScreen gameServerScreen;
	private GameClientScreen gameClientScreen;
	
	@Override
	public void create() {
		// TODO Auto-generated method stub
		setScreen(getResourceScreen());
	}

	public Screen getGameScreen() {
		if(gameScreen==null) this.gameScreen=new GameScreen(this);
		return gameScreen;
	}
	
	public Screen getScoreScreen(Scores score){
		if(scoreScreen==null) this.scoreScreen=new ScoreScreen(this);
		scoreScreen.setScore(score);
		return scoreScreen;
	}
	
	public Screen getResourceScreen(){
		if(resourceScreen==null)this.resourceScreen=new ResourceScreen(this);
		assetManager=new ResourceManager();
		return resourceScreen;
	}
	
	public ResourceManager getResourceManager(){
//		if(this.assetManager==null)assetManager=new ResourceManager();
		return assetManager;
	}
	
	public Screen getMenuScreen(){
		if(this.menuScreen==null) this.menuScreen=new MenuScreen(this);
		return menuScreen;
	}
	
	public Screen getGameServerScreen(){
		if(this.gameServerScreen==null) this.gameServerScreen=new GameServerScreen(this);
		return gameServerScreen;
	}

	public void resumeScreen(Screen gameScreen2) {
		// TODO Auto-generated method stub
		resourceScreen.setScreen(gameScreen2);
	}
	
	public void restartGame(){
		this.getGameScreen();
		this.gameScreen.restart();
	}

	public Screen getGameClientScreen() {
		// TODO Auto-generated method stub
		if(this.gameClientScreen==null) this.gameClientScreen=new GameClientScreen(this);
		return gameClientScreen;
	}
}
